package com.hzit.mmcb.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hzit.mmcb.core.pojo.entity.IntegralGrade;
import com.hzit.mmcb.core.mapper.IntegralGradeMapper;
import com.hzit.mmcb.core.service.IntegralGradeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 积分等级表 服务实现类
 * </p>
 *
 * @author ljh
 * @since 2024-08-27
 */
@Service
public class IntegralGradeServiceImpl extends ServiceImpl<IntegralGradeMapper, IntegralGrade> implements IntegralGradeService {

    @Override
    public boolean isExist(Long id,Integer integralStart, Integer integralEnd) {
        List<IntegralGrade> list=this.baseMapper.isExist(id,integralStart,integralEnd);
        if (list.size()!=0){
            return true;
        }
        return false;
    }

    @Override
    public boolean isExist(Integer integralStart, Integer integralEnd) {
        List<IntegralGrade> list=this.baseMapper.isAddExist(integralStart,integralEnd);
        if (list.size()!=0){
            return true;
        }
        return false;
    }

    @Override
    public List<IntegralGrade> listAsc() {
        QueryWrapper<IntegralGrade> queryWrapper=new QueryWrapper<>();
        queryWrapper.orderByAsc("integral_start");
        List<IntegralGrade> list = this.list(queryWrapper);
        return list;
    }
}
